﻿USE [ESRP]
GO

/****** Object:  Table [dbo].[DocAmix]    Script Date: 06/26/2009 13:12:37 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[DocAmix](
	[IDDocument] [int] IDENTITY(1,1) NOT NULL,
	[Tip] [nvarchar](2) NULL,
	[NrInventar] [varchar](20) NOT NULL,
	[Denumire] [varchar](100) NULL,
	[IdClasificare] [int] NULL,
	[IDDepartament] [int] NULL,
	[Cont] [varchar](50) NULL,
	[ValoareInventar] [decimal](18, 2) NULL,
	[DurataAmortizare] [int] NULL,
	[RegimAmortizare] [int] NULL,
	[DataDoc] [datetime] NULL,
	[NumarDoc] [decimal](10, 0) NOT NULL,
	[ComisiaRec] [varchar](100) NULL,
	[DurExtindere] [int] NULL,
	[CodUnitate] [smallint] NOT NULL,
 CONSTRAINT [PK_DocAmix] PRIMARY KEY CLUSTERED 
(
	[IDDocument] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[DocAmix]  WITH CHECK ADD  CONSTRAINT [FK_DocAmix_RegistruAmix] FOREIGN KEY([NrInventar], [CodUnitate])
REFERENCES [dbo].[RegistruAmix] ([NrInventar], [CodUnitate])
GO

ALTER TABLE [dbo].[DocAmix] CHECK CONSTRAINT [FK_DocAmix_RegistruAmix]
GO

ALTER TABLE [dbo].[DocAmix]  WITH CHECK ADD  CONSTRAINT [FK_DocAmix_Unitati] FOREIGN KEY([CodUnitate])
REFERENCES [dbo].[Unitati] ([CodUnitate])
GO

ALTER TABLE [dbo].[DocAmix] CHECK CONSTRAINT [FK_DocAmix_Unitati]
GO

ALTER TABLE [dbo].[DocAmix] ADD  CONSTRAINT [DF_DocAmix_CodUnitate]  DEFAULT ((0)) FOR [CodUnitate]
GO


